<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            box-sizing: border-box;
            width: 300px;
            height: 400px;
            padding: 10px;
            line-height: 30px;
            border: 1px solid gray;
        }

        .title {
            font-size: 16px;
            font-weight: 700;
            display: flex;
            justify-content: space-between;
        }

        .list {
            font-size: 14px;
            color: blue;
        }
    </style>
</head>

<body>
    <div class="list"> 
        <div></div>
    </div>

</body>
</html>
<script>
    function ajax() {
        //1.创建请求对象
        var xhr = new XMLHttpRequest();

        //2.配置请求对象
        xhr.open('get', './百度热搜.json');

        //3.设置回调函数
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                document.querySelector('.list').innerHTML = (JSON.parse(xhr.responseText).arr.map((item) => {
                return `<div>${item}</div>`}).join(''));
            }
        }
        //4.发送请求
        xhr.send();
    }
    ajax()
</script>